package com.lixiaoyu.controller;

import com.lixiaoyu.service.ExpressService;
import com.lixiaoyu.service.impl.ExpressServiceImpl;

/**
 * 控制层 调用方法
 */
public class ExpressController {

    ExpressService expressService;
    ExpressServiceImpl expService = new ExpressServiceImpl();

    /**
     * 登陆操作
     * @param userName 账号
     * @param passWord 密码
     * @return int 0管理员登陆成功-1普通用户登陆成功-2密码错误-3账户不存在
     */
    public int goLogin(String userName, int passWord) {
        System.out.println("2342");
        //获取账户和密码
        String[][] userPassList = expressService.getUserPassWord(userName,passWord);

        if(userPassList[0][0].equals(userName)){
            if(userPassList[0][1].equals(passWord)){
                if(userName.equals("admin")){
                    return 0;
                }else{
                    return 1;
                }
            }
            return 2;
        }
        return 3;
    }


    /**
     * 查询快递  条件：取件码
     * @param getExpressCode 取件码
     * @return
     */
    public String[][] selectUserExpress(int getExpressCode) {
        String[][] expressList = expressService.selectUserExpress(getExpressCode);
        return expressList;
    }
}
